package vertxZeebe.jobworker;

import io.vertx.core.json.JsonObject;
import io.zeebe.client.ZeebeClient;
import io.zeebe.client.api.response.ActivatedJob;
import io.zeebe.client.api.worker.JobClient;
import io.zeebe.client.api.worker.JobHandler;

public class GJobWorker implements JobHandler {
    ZeebeClient zeebeClient;

    public GJobWorker(ZeebeClient zeebeClient) {
        this.zeebeClient = zeebeClient;
    }

    @Override
    public void handle(JobClient client, ActivatedJob job) {
        System.out.println("开始执行GJobWorker");
        System.out.println("输入变量G=1");

        JsonObject input=new JsonObject()
                .put("G",1);
        client.newCompleteCommand(job.getKey())
                .variables(input.encode())
                .send()
                .join();
    }
}
